/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.commands;

import com.cea.papyrus.diagraminterchange2.di2.GraphElement;
import com.cea.papyrus.diagraminterchange2.di2.GraphNode;


/**
 * A command to remove a shape from its parent.
 * The command can be undone or redone.
 */
public class GraphNodeDeleteWithSemanticParentCommand extends GraphNodeDeleteCommand {

	protected GraphElement oldSemanticParent;
	
	public GraphNodeDeleteWithSemanticParentCommand(GraphElement parent,
			GraphNode child, GraphElement semanticParent) {
		super(parent, child);
		// TODO Auto-generated constructor stub
		this.oldSemanticParent=semanticParent;
	}

	
	public void execute() {
		super.execute();
		child.setSemanticParent(null);
	}

	public void redo() {
		super.redo();
		child.setSemanticParent(null);
	}

	@SuppressWarnings("unchecked")
	public void undo() {
		child.setSemanticParent(oldSemanticParent);
		super.undo();
	}
}
